<?php
/**
 * Gerenciador de States do sistema
 * @author cristiano
 *
 */
class StateManager {
	private static $instancia;
	private static $page_state;
	private static $ajax_state;

	/**
	 * Método singleton do objeto
	 * @return StateManager
	 */
	public static function GetInstancia(){
		if(!isset(self::$instancia)){
				self::$instancia = new StateManager;
		}
		return self::$instancia;
	}

	/**
	 * retorna o State atual da página
	 * @return States_PageStage
	 */
	public function PageState(){
		if(!self::$page_state){
			self::$page_state = States_PageStage::GetInstancia();
		}

		return self::$page_state;
	}

	/**
	 * retorna o state atual do ajax
	 * @return States_AjaxState
	 */
	public function AjaxState(){
		if(!self::$ajax_state){
			self::$ajax_state = States_AjaxState::GetInstancia();
		}

		return self::$ajax_state;
	}
}